function distance(x1, y1, x2, y2) {
    // square函数的作用域被限定在distance函数之内
    // 藏起函数内的函数
    function square(x) {
        return x * x;
    }
    return Math.sqrt(square(x2 - x1) + square(y2 - y1));
}
let dist = distance(0, 0, 3, 4);
console.log(dist); // 输出